﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.models.world.vos.actors {
    import flash.events.*;
    import flash.geom.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;

    public class PatientVO extends AbstractActorVO implements IMoving, ITreatable, ISpeaking {

        protected var _diseaseId:int;
        private var _diseaseName:String;
        private var _isNewDisease:Boolean;
        private var _durationType:String;
        private var _treatments:Array;
        private var _clickHandler:Function;
        private var _dismissed:Boolean;// = false
        private var _poked:Boolean;// = false

        public function PatientVO(_arg1:Object, _arg2:IEventDispatcher){
            super(_arg1, _arg2);
            this._diseaseId = _arg1[ProtocolConstants.DISEASE_ID];
            this._diseaseName = _arg1[ProtocolConstants.DISEASE_NAME];
            this._isNewDisease = _arg1[ProtocolConstants.IS_NEW_DISEASE];
            this._durationType = _arg1[ProtocolConstants.DURATION_TYPE];
            speechBubblePosition = new Point(30, -200);
        }
        public function get diseaseId():int{
            return (this._diseaseId);
        }
        public function get diseaseName():String{
            return (this._diseaseName);
        }
        public function get diseaseType():String{
            return ((type + this._diseaseName));
        }
        public function get durationType():String{
            return (this._durationType);
        }
        public function get petDisease():String{
            return ((type + this._diseaseName));
        }
        public function get isNewDisease():Boolean{
            return (this._isNewDisease);
        }
        public function get treatments():Array{
            return (this._treatments);
        }
        public function set treatments(_arg1:Array):void{
            this._treatments = _arg1;
        }
        public function get currentTreatment():ITreatment{
            return (this.firstUnfinishedTreatment);
        }
        public function get isLastTreatment():Boolean{
            var _local1:ITreatment = (this._treatments[(this._treatments.length - 1)] as ITreatment);
            return ((this.currentTreatment.id == _local1.id));
        }
        public function get dismissed():Boolean{
            return (this._dismissed);
        }
        public function set dismissed(_arg1:Boolean):void{
            this._dismissed = _arg1;
        }
        public function moveToNextTarget(_arg1:String):void{
            targetType = _arg1;
            checkMove();
            dispatch(new InfoEvent(EventConstants.PATIENT_SPEECH_BUBBLE_UPDATE, id));
        }
        public function moveToNextTreatment():void{
            var _local1:String = (this.currentTreatment) ? this.currentTreatment.roomType : GameConstants.TYPE_ENTRANCE_AREA;
            this.moveToNextTarget(_local1);
        }
        private function get firstUnfinishedTreatment():ITreatment{
            var _local1:ITreatment;
            for each (_local1 in this._treatments) {
                if (!_local1.isFinalized){
                    return (_local1);
                };
            };
            return (null);
        }
        public function get lastFinalizedTreatment():ITreatment{
            var _local1:ITreatment;
            var _local2:ITreatment;
            for each (_local2 in this._treatments) {
                if (!_local2.isFinalized){
                    return (_local1);
                };
                _local1 = _local2;
            };
            return (_local1);
        }
        override public function set state(_arg1:String):void{
            super.state = _arg1;
        }
        public function set clickHandler(_arg1:Function):void{
            this._clickHandler = _arg1;
        }
        public function get clickHandler():Function{
            return (this._clickHandler);
        }
        public function get hasClickHandler():Boolean{
            return (!((this._clickHandler == null)));
        }
        public function get hasTreatmentsFinished():Boolean{
            return (((!(this.currentTreatment)) || (!(this.currentTreatment.isTreatment))));
        }
        override public function get animationState():String{
            return ((this.hasTreatmentsFinished) ? WorldConstants.CURED : super.animationState);
        }
        public function get poked():Boolean{
            return (this._poked);
        }
        public function set poked(_arg1:Boolean):void{
            this._poked = _arg1;
        }

    }
}//package net.wooga.pets.models.world.vos.actors 
